
// 649. Dota2 参议院
function predictPartyVictory(senate: string): string {
    const len = senate.length
    let set = new Set<number>()
    let r = new Array<number>()
    let d = new Array<number>()
    let seq = senate.split('')
    seq.forEach((v,i)=>{
        v === 'R' ? r.push(i): d.push(i)
    })
    let index = 0
    while(r.length!=0&&d.length!=0){
        if(!set.has(index)){
            if(seq[index]==='R'){
                let i = d.shift()!
                set.add(i)
                let t = r.shift()!
                r.push(t)
            }else{
                let i = r.shift()!
                set.add(i)
                let t = d.shift()!
                d.push(t)
            }
        }
        index = (index+1)%len
    }
    return r.length===0? 'Dire':'Radiant'
};